In [ ]:
import tensorflow as tf
from gan import GAN
from wgan import WGAN
from cramer_gan import CramerGAN
In [ ]:
data_params = {
'n_mixture': 8,
'std': 0.05,
'radius': 1,
}
generator_params = {
'n_layers': 4,
'n_hidden': 256,
'activation_fn': tf.nn.relu,
}
discriminator_params = {
'n_layers': 4,
'n_hidden': 256,
'activation_fn': tf.nn.relu,
}
iterations = 50000
batch_size = 128
save_step = 2500
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'modified_objective': False,
'optimization': {
'algorithm': 'alternating',
'discriminator_steps': 5,
},
}
tf.reset_default_graph()
gan = GAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='alternating-gan')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'modified_objective': True,
'optimization': {
'algorithm': 'alternating',
'discriminator_steps': 5,
},
}
tf.reset_default_graph()
gan = GAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='alternating-gan-2')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'gradient_penalty': False,
'optimization': {
'algorithm': 'alternating',
'discriminator_steps': 5,
},
}
tf.reset_default_graph()
gan = WGAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='alternating-wgan')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'gradient_penalty': True,
'lambda': 0.1,
'optimization': {
'algorithm': 'alternating',
'discriminator_steps': 5,
},
}
tf.reset_default_graph()
gan = WGAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='alternating-wgan-gp')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': {
'n_layers': 4,
'n_hidden': 256,
'activation_fn': tf.nn.relu,
'output_dim': 256,
},
'lambda': 0.1,
'optimization': {
'algorithm': 'alternating',
'discriminator_steps': 5,
},
}
tf.reset_default_graph()
gan = CramerGAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='alternating-cramer-gan')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'modified_objective': False,
'optimization': {
'algorithm': 'consensus',
'gamma': 10,
},
}
tf.reset_default_graph()
gan = GAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='consensus-gan')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'modified_objective': True,
'optimization': {
'algorithm': 'consensus',
'gamma': 10,
},
}
tf.reset_default_graph()
gan = GAN(params)
gan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='consensus-gan-2')
In [ ]:
params = {
'z_dim': 64,
'data': data_params,
'generator': generator_params,
'discriminator': discriminator_params,
'gradient_penalty': False,
'optimization': {
'algorithm': 'consensus',
'gamma': 10,
},
}
tf.reset_default_graph()
wgan = WGAN(params)
wgan.train(iterations=iterations, batch_size=batch_size, save_step=save_step, dirname='consensus-wgan')